package com.xyzpool.test;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 测试拼SQL中IN中的,
 * @author yangzhen
 *
 */
public class GetWhereInSQLTestor {
	static String getWhereInSQL(String[] strs){
		StringBuffer sb = new StringBuffer();
		for(int i=0;i<strs.length;i++){
			sb.append(strs[i]);
			if(i<strs.length-2){
				sb.append(",");
			}
		}
		return "("+sb.toString()+")";
	}
	public static void main(String[] args) {
//		String[] strs = {"a","B"};
//		System.out.println(getWhereInSQL(strs));
		String[] strs = 
		{
//				null,
//				"",
				"378-31295-12, CPJ16F05+378-31295-11, CPR16A01",//SKU1, LOC2+SKU2, LOC2			
				"GC10084A1L+GC10084A1R, CPQ13B01",//SKU1+SKU2, LOC2
				"GC10084A1L+GC10084A1R, CPQ13B01",//SKU1+SKU2, LOC2
				"352-13592-10-PM, CPB14C05",//SKU, LOC
				"378-36313-22+378-36313-21",//SKU1,SKU2
				"ORYH3269B-NE95"//SKU
		};
//		testMatch("[^,+]*(, CP[^,+]*)?([+][^,+]*(, CP[^,+]*)?)*",strs);
		//String[] strs2 = {", CPB14C05"};
		//testFit(strs2,", CP[^,+]*");
		//String[] strs3 = {"378-36313-22","378-36313-22+378-36313-21"};
		//testFit("[^,+]*(, CP[^,+]*)?",strs3);
		//test match
//		String[] testStr = {"371-36359-01, CPG27F02","378-31295-12, CPJ16F05+378-31295-11, CPR16A01"};
//		testMatch(", CP[^,+].*[+]?",testStr);
		
//		String[] str = {"CP1903501(6)","SS1903480(NA)","AP1903562(NA)+AP1903563(NA)","AP1903562(NA)+AP1903563","AP1903562+AP1903563","AP1903562+AP1903563(NA)","AMZ1903459"};
//		testFit("^[a-zA-Z]{1,3}[\\d]+([(].*[)])?([+][a-zA-Z]{1,3}[\\d]+([(].*[)])?)*$",str);
//		Matcher matcher = Pattern.compile("\\d+").matcher("AMZ1903459");
//		matcher.find();
//		System.out.println(matcher.group());
//		if(matcher.matches()){
//			System.out.println(matcher);
//		}else{
//			System.out.println("FAilure!");
//		}
//		Pattern.compile("[a-zA-Z]{1,3}").matcher("AMZ1903459").group();
	}
	

}
